Compatibility with `term` *0.2.9*
authorSebastian Thiel <byronimo@gmail.com>
Sat, 20 Jun 2015 13:56:03 +0000 (15:56 +0200)
committerSebastian Thiel <byronimo@gmail.com>
Sat, 20 Jun 2015 20:08:15 +0000 (22:08 +0200)
When attempting to compile cargo with the latest `term` crate,
one would face compilation issues due to an attempt to declare
a `Terminal` type without its apparently new associated type
called `Output`.

The fix involves the removal of the `UghWHyIsThisNecessary` type,
and declares the `Terminal` type as
`Terminal<Output=Box<Write + Send>>`.

Cargo.lock
src/cargo/core/shell.rs

index 3a3b5aab839bc6459cf673ff7d520dc84ee6a7ef..844c0ce9284e9a87d7998b7200abed11fffeeff0 100644 (file)
@@ -24,7 +24,7 @@ dependencies = [
  "semver 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)",
  "tar 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
  "tempdir 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
- "term 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
+ "term 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
  "threadpool 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
  "time 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)",
  "toml 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -305,7 +305,7 @@ dependencies = [
 
 [[package]]
 name = "term"
-version = "0.2.7"
+version = "0.2.9"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "kernel32-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
index 605b9a175bededcf540d7cdf79e8fc6567c75df4..03425717580852e96fbc47dbc1c189af7e7d5caa 100644 (file)
@@ -17,7 +17,7 @@ pub struct ShellConfig {
 
 enum AdequateTerminal {
     NoColor(Box<Write + Send>),
-    Colored(Box<Terminal<UghWhyIsThisNecessary> + Send>)
+    Colored(Box<Terminal<Output=Box<Write + Send>> + Send>)
 }
 
 pub struct Shell {
@@ -31,10 +31,6 @@ pub struct MultiShell {
     verbose: bool
 }
 
-struct UghWhyIsThisNecessary {
-    inner: Box<Write + Send>,
-}
-
 impl MultiShell {
     pub fn new(out: Shell, err: Shell, verbose: bool) -> MultiShell {
         MultiShell { out: out, err: err, verbose: verbose }
@@ -91,7 +87,6 @@ impl MultiShell {
 
 impl Shell {
     pub fn create(out: Box<Write + Send>, config: ShellConfig) -> Shell {
-        let out = UghWhyIsThisNecessary { inner: out };
         if config.tty && config.color {
             let term = TerminfoTerminal::new(out);
             term.map(|t| Shell {
@@ -101,7 +96,7 @@ impl Shell {
                 Shell { terminal: NoColor(Box::new(io::stderr())), config: config }
             })
         } else {
-            Shell { terminal: NoColor(out.inner), config: config }
+            Shell { terminal: NoColor(out), config: config }
         }
     }
 
@@ -185,13 +180,4 @@ impl Write for Shell {
             NoColor(ref mut n) => n.flush()
         }
     }
-}
-
-impl Write for UghWhyIsThisNecessary {
-    fn write(&mut self, bytes: &[u8]) -> io::Result<usize> {
-        self.inner.write(bytes)
-    }
-    fn flush(&mut self) -> io::Result<()> {
-        self.inner.flush()
-    }
-}
+}
\ No newline at end of file